<?php 
$this->layout = '//layouts/admin/blog';
$this->pageTitle = $model->isNewRecord ? '撰写新文章' : '修改文章' . '【'.$model->title.'】';
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/ueditor/ueditor.config.js',CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/ueditor/ueditor.all.js',CClientScript::POS_END);
?>
<div class="container container-admin">
    <div class='row'>
        <div class="span3">
            <?php $this->beginWidget('AdminLeftNavWidget');$this->endWidget();?>
        </div>
        <div class='span9'>
            <div class='page-header' style='width:106%'>
                <h2>
                    <span class='fui-new'></span>
                    <?php echo $model->isNewRecord ? '撰写新文章' : '编辑文章'?>
                    <small>
                        <a target="_blank" href='<?php echo Yii::app()->createUrl('site/view',array('id'=>$model->id));?>'>
                            <?php echo $model->isNewRecord ? '' : '查看文章'?>
                        </a>
                    </small>
                </h2>
            </div>
            <div class="row">
                <?php $form=$this->beginWidget('CActiveForm', array(
                    'id'=>'blog-form',
                    'enableAjaxValidation'=>true,
                    'htmlOptions'=>array(
                        'class'=>'form-horizontal',
                    )
                )); ?>
                <?php echo $form->hiddenField($model,'user_id',array('value'=>Yii::app()->admin->id, 'class'=>'')); ?>
                <div class='span7 left'>
                    <div class="control-group">
                        <div class="">
                            <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255,'class'=>'span7','placeholder'=>'在此键入标题','style'=>'padding:5px')); ?>
                            <?php echo $form->error($model,'title',array('class'=>'alert')); ?>
                        </div>
                    </div>

                    <div class="control-group">
                        <div id='' class="">
                            <div class="textarea">
                                <?php echo $form->textarea($model,'description'); ?> 
                            </div>
                        </div>
                        <?php echo $form->error($model,'description',array('class'=>'alert')); ?>
                    </div>

                    <div class="control-group">
                        <div class="">
                            <?php echo CHtml::submitButton($model->isNewRecord ? '发布文章' : '更新文章',array('class'=>'btn btn-primary','style'=>'padding:5px')); ?>
                        </div>
                    </div>
                </div>
                <div class='span2 right'>
                    <div class="control-group">
                        <?php echo $form->labelEx($model,'type_id',array('class'=>'')); ?>
                        <div class="">
                            <?php echo $form->dropDownList($model,'type_id',Type::getCategoryList('blog')); ?>
                            <?php echo $form->error($model,'type_id',array('class'=>'alert')); ?>
                        </div>
                    </div>

                    <div class="control-group" style='width:220px'>
                        <?php echo $form->labelEx($model,'tag',array('class'=>'')); ?>
                        <div class="">
                            <?php echo $form->textField($model,'tag',array('size'=>60,'maxlength'=>255,'class'=>'tagsinput','id'=>'tagsinput')); ?>
                            <?php echo $form->error($model,'tag',array('class'=>'alert')); ?>
                        </div>
                    </div>
                    <div class="control-group" style='width:220px'>
                        <?php echo $form->labelEx($model,'source_url',array('class'=>'')); ?>
                        <div class="">
                            <?php echo $form->textField($model,'source_url',array('size'=>60,'maxlength'=>255,'class'=>'span2','style'=>'width: 205px;height: 10px;line-height: 10px;')); ?>
                            <?php echo $form->error($model,'source_url',array('class'=>'alert')); ?>
                        </div>
                    </div>
                </div>
                <?php $this->endWidget(); ?>
            </div>
        </div>
    </div>
</div>
<script>
$(function(){
    var editor = new UE.ui.Editor();
    editor.render("Blog_description");
});
</script>
